package com.tearreview.service.impl;

import com.github.pagehelper.PageHelper;
import com.tearreview.mapper.UserMapper;
import com.tearreview.pojo.User;
import com.tearreview.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;


    @Override
    public List<User> findAllByPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return      userMapper.findAll();
    }

    @Override
    public List<User> findAll() {
        return  userMapper.findAll();
    }

    @Override
    public User findById(int id) {
        return userMapper.findById(id);
    }

    @Override
    public void delete(int id) {
userMapper.delete(id);
    }

    @Override
    public void add(User user) {
        userMapper.add(user);
    }

    @Override
    public void update(User user) {
userMapper.update(user);
    }
}
